﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Pixysoft.Framework.Configurations
{
    public interface IHtmlNodesCollection :
         IEnumerable<IHtmlNode>, IEnumerator<IHtmlNode>
    {
        /// <summary>
        /// 添加声明
        /// </summary>
        /// <param name="rawAttribute"></param>
        /// <returns></returns>
        IHtmlNode AddDeclaration(string rawAttribute);

        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="text"></param>
        IHtmlNode Add(string elementName, string rawAttribute);

        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="text"></param>
        IHtmlNode Add(string elementName, string rawAttribute, string text);

        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="text"></param>
        void Add(IHtmlNode node);

        /// <summary>
        /// 删除全部
        /// </summary>
        void RemoveAll();

        /// <summary>
        /// 根据名字删除
        /// </summary>
        /// <param name="elementName"></param>
        void Remove(string elementName);

        /// <summary>
        /// 根据位置获取节点
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        IHtmlNode this[int index] { get;}

        /// <summary>
        /// 根据名称获取节点
        /// </summary>
        /// <param name="elementName"></param>
        /// <returns></returns>
        IHtmlNodeCollection this[string elementName] { get;}

        /// <summary>
        /// 数目
        /// </summary>
        int Count { get; }

        /// <summary>
        /// 是否包含节点
        /// </summary>
        /// <param name="elementName"></param>
        /// <returns></returns>
        bool Contains(string elementName);

        string Serialize(bool indent);

        IHtmlNode[] SearchByClass(string classid);

        IHtmlNode[] SearchById(string id);
    }
}
